﻿package dut.ir.lxb.weibo.bean;

import dut.ir.lxb.weibo.util.SpiderConfig;

public class WeiboBean
{
	protected String uid = "";
	
	protected String mid = "";
	
	protected String content = "";
	
	protected String mapData = "";
	
	protected String nickname;
	
	protected int likeNum = 0;
	
	protected int forwardNum = 0;
	
	protected int commentNum = 0;
	
	protected String time = "";
	
	protected String from = "";
	
	protected String url = "";
	
	protected boolean isforward = false;
	
	protected String eventName = "";
	
	
	//转发信息
	protected String forwardUid = "";
	
	protected String forwardNickname = "";
	
	protected String forwardMid = "";
	
	protected String forwardContent = "";
	
	protected String forwardFrom = "";

	@Override
	public String toString()
	{
		String strValue = mid + "\t" + uid + "\t" + content + "\t" + mapData + "\t" + likeNum + "\t"
			+ forwardNum + "\t" + commentNum + "\t" + time + "\t" + from + "\t" + isforward + "\t"
			+ forwardUid + "\t" + forwardNickname + "\t" + forwardMid + "\t" + forwardContent + "\t" + forwardFrom;
		
		return strValue;
	}
	
	public String toXMLText()
	{
		StringBuilder sb = new StringBuilder();
		
		sb.append("<TEXT>\n");
		sb.append(String.format("<MID>%s</MID>\n", mid));
		sb.append(String.format("<UID>%s</UID>\n", uid));
		sb.append(String.format("<NICKNAME>%s</NICKNAME>\n", nickname));
		sb.append(String.format("<URL>%s</URL>\n", url));
		String fullContent = this.content;
		
		if(eventName != null && eventName.length() > 0)
			fullContent = "#" + eventName + "#" + fullContent;
		if(isforward)
			fullContent = forwardContent + " " + fullContent;
		sb.append(String.format("<CONTENT>%s</CONTENT>\n", fullContent));
		sb.append(String.format("<DATE>%s</DATE>\n", time));
		sb.append(String.format("<EVENT>%s</EVENT>\n", eventName));
		sb.append(String.format("<AREA>%s</AREA>\n", mapData));
		sb.append("</TEXT>\n");
		
		return sb.toString();
	}
	
	public static String getHeader()
	{
		String header = "mid\tuid\tcontent\tmapdata\tlike\tforward\tcomment\tdatetime\tfrom\tisforward" +
		"\tforwarduid\tforwardnickname\tforwardmid\tforwardcontent\tforwardfrom";
		
		return header;
	}
	
	
	public String getUid()
	{
	
		return uid;
	}

	public void setUid(String uid)
	{
	
		this.uid = uid;
	}

	public String getMid()
	{
	
		return mid;
	}

	public void setMid(String mid)
	{
	
		this.mid = mid;
	}

	public String getContent()
	{
	
		return content.replaceAll(SpiderConfig.emojPattern, "").replace("🤗", "");
	}

	public void setContent(String content)
	{
	
		this.content = content.replaceAll(SpiderConfig.emojPattern, "").replace("🤗", "");
	}

	public String getMapData()
	{
	
		return mapData;
	}

	public void setMapData(String mapData)
	{
	
		this.mapData = mapData;
	}

	public int getLikeNum()
	{
	
		return likeNum;
	}

	public void setLikeNum(int likeNum)
	{
	
		this.likeNum = likeNum;
	}

	public int getForwardNum()
	{
	
		return forwardNum;
	}

	public void setForwardNum(int forwardNum)
	{
	
		this.forwardNum = forwardNum;
	}

	public int getCommentNum()
	{
	
		return commentNum;
	}

	public void setCommentNum(int commentNum)
	{
	
		this.commentNum = commentNum;
	}

	public String getTime()
	{
	
		return time;
	}

	public void setTime(String time)
	{
	
		this.time = time;
	}

	public boolean isforward()
	{
	
		return isforward;
	}

	public void setIsforward(boolean isforward)
	{
	
		this.isforward = isforward;
	}

	public String getFrom()
	{
	
		return from;
	}

	public void setFrom(String from)
	{
	
		this.from = from;
	}

	public String getForwardUid()
	{
	
		return forwardUid;
	}

	public void setForwardUid(String forwardUid)
	{
	
		this.forwardUid = forwardUid;
	}

	public String getForwardNickname()
	{
	
		return forwardNickname;
	}

	public void setForwardNickname(String forwardNickname)
	{
	
		this.forwardNickname = forwardNickname;
	}

	public String getForwardMid()
	{
	
		return forwardMid;
	}

	public void setForwardMid(String forwardMid)
	{
	
		this.forwardMid = forwardMid;
	}

	public String getForwardContent()
	{
	
		return forwardContent.replaceAll(SpiderConfig.emojPattern, "");
	}

	public void setForwardContent(String forwardContent)
	{
	
		this.forwardContent = forwardContent.replaceAll(SpiderConfig.emojPattern, "");;
	}

	public String getForwardFrom()
	{
	
		return forwardFrom;
	}

	public void setForwardFrom(String forwardFrom)
	{
	
		this.forwardFrom = forwardFrom;
	}

	public String getUrl()
	{
	
		return url;
	}

	public void setUrl(String url)
	{
	
		this.url = url;
	}

	public String getNickname()
	{
	
		return nickname;
	}

	public void setNickname(String nickname)
	{
	
		this.nickname = nickname;
	}

	public String getEventName()
	{
	
		return eventName;
	}

	public void setEventName(String eventName)
	{
	
		this.eventName = eventName;
	}
	
	
	//protected String fuid;
	
	
	
	
	
	
	
	
}
